<template>
  <div class="home">
    <el-button type="primary" @click="testMessage">测试</el-button>
  </div>
</template>

<script lang="ts" setup>
import { message } from '@/services/message';

defineOptions({
  name: 'Home',
  meta: {
    title: '首页'
  }
});

const testMessage = () => {
  const arr = ['success', 'error', 'warning', 'info'];
  const index = Math.round(Math.random() * 3);
  message[arr[index] as ('success' | 'error' | 'warning' |'info')]('测试消息服务');
};
</script>

<style lang="scss" scoped>
.home {
  box-sizing: border-box;
  height: 100%;
  padding: 16px;
}
</style>
